package com.wz.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;


import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class UserInfo {

    private  Integer    userID;
    private  Integer    departmentID;
    private  Integer    roleID;
    private  String     userNumber;
    private  String     loginName;
    private  String     loginPwd;
    private  String     userName;

    @Min( value = 18,message = "未满18岁")
    private  Integer    userAge;

    private  Integer    userSex;

    @Length(min = 11, max = 11, message = "手机号只能为11位")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
    private  String     userTel;

    private  String     userAddress;

    private  String     userIphone;
    private  String     userRemarks;
    private  Integer    userStatr;
    private  Date       entryTime;

    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private  Date       dimissionTime;

    private  Integer    basePay;



    /**关系表部门、角色*/
    @NotNull
    private Department department;
    private Role       role;




    //伪造数据时留存
    /*private  Integer userID;
    private  String  userName;
    private  String  email;
    private  Integer sex;//1:男 0:女
    private Date birth;
    private Department department;

    public UserInfo(Integer userID, String userName, String email, Integer sex, Date birth, Department department) {
        this.userID = userID;
        this.userName = userName;
        this.email = email;
        this.sex = sex;
        this.birth =new Date();//建立默认时间
        this.department = department;
    }*/
}
